import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import AMap from "AMap";//高德地图
Vue.prototype.gdmap = AMap

import bus from '../utils/bus.js' //自定义总线传值
Vue.prototype.bus = bus

import * as request from '../utils/request.js' //自定义请求
Vue.prototype.request = request

import ElementUI from 'element-ui'; //饿了吗样式组件库
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

import 'normalize.css/normalize.css' //初始化css


import VueLazyComponent from '@xunlei/vue-lazy-component' //迅雷组件懒加载
Vue.use(VueLazyComponent)


import VueLazyLoad from 'vue-lazyload' //图片懒加载
Vue.use(VueLazyLoad, {
	loading: require("../public/headPic.jpg") // @/assets/
})

import animated from 'animate.css' //第三方动画库
Vue.use(animated)


const requireComponent = require.context( //自动注册基础组件
	'./components',
	false,
	/Base[A-Z]\w+\.(vue|js)$/
)
requireComponent.keys().forEach(fileName => {
	const componentConfig = requireComponent(fileName)
	Vue.component(
		fileName.substr(2).split('.')[0],
		function(resolve, reject) {
			setTimeout(() => {
				resolve(componentConfig.default || componentConfig)
			}, 500)
		}
	)
})


Vue.config.productionTip = false
new Vue({
	router,
	store,
	render: h => h(App)
}).$mount('#app')
